package com.pucong.gitee.database.backup.configuration.quartz.job;

import com.pucong.gitee.database.backup.business.sys.service.GetLogFileContentService;
import com.pucong.gitee.database.backup.business.sys.service.SysFileService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 日志文件、临时文件定时任务
 */
@Slf4j
public class QuartzLogFileTask implements Job {

    @Autowired
    private SysFileService sysFileService;

    @Autowired
    private GetLogFileContentService getLogFileContentService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        // 删除临时文件
        sysFileService.deleteTmpFile();
        // 删除日志文件
        getLogFileContentService.deleteLogFile();
    }
}
